package com.dinghui.mybatis.config;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description 描述
 */
@AllArgsConstructor
@Getter
public enum ResultCode {

    //自定义描述
    USER_DEFINED_DESC("111", ""),

    TOKEN_STALE("401", "登录信息过期！");

    private String code;
    private String desc;

    public BizException getBizException() {
        return new BizException(this.code, this.desc);
    }

    public BizException getBizException(String desc) {
        return new BizException(this.code, desc);
    }


    public void throwBizException() throws BizException {
        throw new BizException(this.code, this.desc);
    }

    public void throwBizException(String desc) throws BizException {
        throw new BizException(this.code, desc);
    }
}
